<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="common_css :: commonHeader('表结构管理')"></head>
<body>
<!--表明细信息-->
<form method="post" id="tabfrom">
    <div style="padding:2px" class="easyui-panel" title="数据查询">
        <table class="form-table">
            <tr>
                <td align="right">所属模块：</td>
                <td>
                    <input id="selColumnModular" name="selModular" style="width: 350px" multiple="multiple"
                           cascadeCheck="true"
                           data-options="required:false,prompt:'==请选择=='"
                           class="easyui-combotree"/>
                </td>
                <td align="right">所属客户：</td>
                <td>
                    <input id="selColumnCustomer" name="selCustomer" style="width: 350px" multiple="multiple"
                           cascadeCheck="true"
                           data-options="required:false,prompt:'==请选择=='"
                           class="easyui-combotree"/>
                </td>
            </tr>
            <tr>
                <td align="right">所属报表：</td>
                <td>
                    <input id="selColumnReport" name="selReport" style="width: 350px" multiple="multiple"
                           cascadeCheck="true"
                           data-options="required:false,prompt:'==请选择==',panelWidth:'auto'"
                           class="easyui-combotree"/>
                </td>
                <td align="right">字典编码：</td>
                <td>
                    <input id="selCodeName" name="selCodeName" class="easyui-combobox" style="width: 350px"
                           data-options="required:false,valueField:'classId',textField:'className',
                            prompt:'==请选择=='"
                    />
                </td>
            </tr>
        </table>
        <table class="form-table">
            <tr>
                <td align="right">字段名称：</td>
                <td align="left">
                    <input id="selColumnName" style="width:150px"/>
                </td>
                <td align="right">字段中文名称：</td>
                <td align="left">
                    <input id="selColumnChineseName" style="width:150px"/>
                </td>
                <td align="right">字段描述：</td>
                <td align="left">
                    <input id="selColumnDescribe" style="width:150px"/>
                </td>
                <td align="right">是否业务主键：</td>
                <td>
                    <input id="selBusinessPrimaryKey" editable="false"
                           class="easyui-combobox" data-options="prompt:'==请选择==',panelHeight:'auto', valueField: 'label', textField: 'value',
                                    data: [{ label: '',  value: '==全部==' },{ label: '1',  value: '是' },{ label: '2', value: '否'}]"/>
                </td>
            </tr>
            <tr>
                <td align="right">字段默认值：</td>
                <td align="left">
                    <input id="selColumnDefault" style="width:150px"/>
                </td>
                <td align="right">字段类型：</td>
                <td align="left">
                    <input style="width:150px" id="selColumnType"
                           data-options="valueField:'value',textField:'showmsg' ,panelHeight:'auto',prompt:'==请选择=='"
                           class="easyui-combobox"/>
                </td>
                <td align="right">字段版本号：</td>
                <td align="left">
                    <input style="width:150px" id="selColumnVersion"
                           data-options="valueField:'value',textField:'showmsg' ,panelHeight:'auto',prompt:'==请选择=='"
                           class="easyui-combobox"/>
                </td>
                <td align="right">状态：</td>
                <td align="left">
                    <input style="width:150px" id="selColumnStatus"
                           data-options="valueField:'value',textField:'showmsg' ,panelHeight:'auto',prompt:'==请选择=='"
                           class="easyui-combobox"/>
                </td>
            </tr>
        </table>
        <table class="form-table">
            <tr>
                <td align="right">表名：</td>
                <td align="left">
                    <input id="selName" style="width:150px"/>
                </td>
                <td align="right">表中文名称：</td>
                <td align="left">
                    <input id="selChineseName" style="width:150px"/>
                </td>
                <td align="right">表所在分层：</td>
                <td align="left">
                    <input style="width:150px" id="selLayered"
                           data-options="valueField:'value',textField:'showmsg'
                                    ,panelHeight:'auto',prompt:'==请选择=='" class="easyui-combobox"/>
                </td>
                <td align="right">表类型：</td>
                <td align="left">
                    <input style="width:150px" id="selFtype"
                           data-options="valueField:'value',textField:'showmsg' ,panelHeight:'auto',prompt:'==请选择=='"
                           class="easyui-combobox"/>
                </td>
            </tr>
            <tr>
                <td align="right">表来源：</td>
                <td align="left">
                    <input style="width:150px" id="selFsource"
                           data-options="valueField:'value',textField:'showmsg' ,panelHeight:'auto',prompt:'==请选择=='"
                           class="easyui-combobox"/>
                    <a class="easyui-linkbutton" iconCls='icon-search' onclick="doSearchDetail();">查询</a>
                </td>
            </tr>
        </table>
    </div>
    <br>
</form>

<div id="toolbar">
    <shiro:hasPermission name="reportworld:tableDetail:add">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add"
           onclick="addDetailInfo()">添加</a>
    </shiro:hasPermission>
    <shiro:hasPermission name="reportworld:tableDetail:edit">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit"
           onclick="editDetailInfo()">修改</a>
    </shiro:hasPermission>
    <shiro:hasPermission name="reportworld:tableDetail:del">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel"
           onclick="delDetailInfo()">删除</a>
    </shiro:hasPermission>
    <shiro:hasPermission name="reportworld:tableDetail:table">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls='icon-cup'
           onclick="getTableInfoDetail();">关联</a>
    </shiro:hasPermission>
    <shiro:hasPermission name="reportworld:tableDetail:update">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls='icon-cart'
           onclick="getTableUpdateInfo('dgDetail','REPORT_TABLE_DETAIL_CODE');">修改记录</a>
    </shiro:hasPermission>

    <shiro:hasPermission name="reportworld:tableDetail:batchUpdate">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls='icon-database-table'
           onclick="batchUpdateTableInfoDetail();">批量修改</a>
    </shiro:hasPermission>
</div>
<div id="dgDetail"></div>

<div id="dlgDetailInfo" class="easyui-dialog" style="width:800px;height:500px"
     closed="true" modal="true" maximizable="true" resizable="true">
    <form method="post" id="myformDetailInfo">
        <div style="padding:20px">
            <table cellpadding="2px" cellspacing="0" class="form-table">
                <input type="hidden" name="id">
                <tr id="tableIdTr">
                    <td align="right">表名：</td>
                    <td>
                        <input name="tableId" id="tableId" class="easyui-combobox" style="width: 350px"
                               data-options=" required: true,valueField:'id',textField:'chineseName',prompt:'==请选择==',panelWidth:'auto'"
                               missingMessage="请选择表名"
                               validType="comboxValidate['tableId','请选择正确表']"
                        />
                    </td>
                </tr>
                <tr>
                    <td align="right">字段名称：</td>
                    <td>
                        <input class="easyui-validatebox" data-options="required:true"
                               missingMessage="请输入字段名称" id="columnName"
                               validType="checkColumnName['columnNameFirst','字段名称已经存在，请更换！']" name="columnName"/>
                        <!--新的-->
                        <input type="hidden" class="textbox" name="columnNameFirst" id="columnNameFirst"/><!--之前的-->
                    </td>
                </tr>
                <tr>
                    <td align="right">中文名称：</td>
                    <td>
                        <input class="easyui-validatebox" data-options="required:true" id="columnChineseName"
                               missingMessage="请输入表中文名" name="columnChineseName"/>
                    </td>
                </tr>
                <tr>
                    <td align="right">是否主键：</td>
                    <td>
                        <input id="primaryKey" name="primaryKey" editable="false"
                               class="easyui-combobox" data-options="prompt:'==请选择==',panelHeight:'auto', valueField: 'label', textField: 'value',
                                    data: [{ label: '1',  value: '是' },{ label: '2', value: '否'}]"/>
                    </td>
                </tr>
                <tr>
                    <td align="right">是否业务主键：</td>
                    <td>
                        <input id="businessPrimaryKey" name="businessPrimaryKey" editable="false"
                               class="easyui-combobox" data-options="prompt:'==请选择==',panelHeight:'auto', valueField: 'label', textField: 'value',
                                    data: [{ label: '1',  value: '是' },{ label: '2', value: '否'}]"/>
                    </td>
                </tr>
                <tr>
                    <td align="right">字段类型：</td>
                    <td>
                        <input id="columnType" name="columnType" class="easyui-combobox"
                               data-options="required:false,valueField:'value',textField:'showmsg',prompt:'==请选择==',panelHeight:'auto'"
                               missingMessage="请维护字段类型" validType="comboxValidate['columnType','请输入字段类型']"/>
                    </td>
                </tr>
                <tr id="columnLengthTr">
                    <td align="right">字段长度：</td>
                    <td><input id="columnLength" name="columnLength" class="easyui-validatebox"
                               data-options="required:false"
                               missingMessage="请输入字段长度,必须数字！"></td>
                </tr>
                <tr id="columnDecimalTr">
                    <td align="right">字段位数：</td>
                    <td><input name="columnDecimal" class="easyui-validatebox" data-options="required:false"
                               missingMessage="请输入字段位数,必须大于0正整数！" validType="integerZero"></td>
                </tr>

                <tr id="columnNullTr">
                    <td align="right">是否可为空：</td>
                    <td>
                        <input id="columnNull" name="columnNull" editable="false"
                               class="easyui-combobox" data-options="prompt:'==请选择==',panelHeight:'auto', valueField: 'label', textField: 'value',
                                    data: [{ label: '1',  value: '是' },{ label: '2', value: '否'}]"/>
                    </td>
                </tr>
                <tr id="sequenceTr">
                    <td align="right">字段顺序：</td>
                    <td>
                        <input name="sequence" class="easyui-validatebox" data-options="required:false"
                               missingMessage="请输入字段位数,必须大于0正整数！" validType="integerZero">
                    </td>
                </tr>
                <tr>
                    <td align="right">状态：</td>
                    <td>
                        <input name="status" id="columnStatus"
                               data-options="valueField:'value',textField:'showmsg' ,panelHeight:'auto',prompt:'==请选择=='"
                               class="easyui-combobox" validType="comboxValidate['columnStatus','请选择状态']"/>
                    </td>
                </tr>
                <td align="right">版本号：</td>
                <td align="left">
                    <input style="width:150px" id="columnVersion" name="version"
                           data-options="valueField:'value',textField:'showmsg' ,panelHeight:'auto',prompt:'==请选择=='"
                           class="easyui-combobox" validType="comboxValidate['columnVersion','请选择版本号']"/>
                </td>
                <tr id="foreignTableTr">
                    <td align="right">外键关联的表：</td>
                    <td>
                        <input name="foreignTable" id="foreignTable" class="easyui-combobox" style="width: 350px"
                               data-options="valueField:'name',textField:'chineseName',prompt:'==请选择==',panelWidth:'auto',
                               validType:['comboxValidate[\'foreignTable\',\'请选择正确外键关联的表\']','checkForeignTableName[\'aaa\',\'不能选择当前表，请更换！\']']"
                               missingMessage="请选择正确外键关联的表"
                        />
                    </td>
                </tr>
                <tr id="foreignTableColumnTr" style="display: none">
                    <td align="right">外键对应表字段：</td>
                    <td>
                        <input name="foreignTableColumn" id="foreignTableColumn" class="easyui-combobox"
                               style="width: 350px" missingMessage="请选择关联表的字段"
                               data-options="required:false,valueField:'columnName',textField:'columnChineseName',prompt:'==请选择=='"
                               validType="comboxValidate['foreignTableColumn','请选择关联表的字段']"/>
                    </td>
                </tr>
                <tr>
                    <td align="right">字典编码：</td>
                    <td>
                        <input name="codeName" id="codeName" class="easyui-combobox" style="width: 350px"
                               data-options="required:false,valueField:'classId',textField:'className',prompt:'==请选择=='"
                               missingMessage="请输入字典编码" validType="comboxValidate['codeName','请输入字典编码']"/>
                    </td>
                </tr>
                <tr id="originalColumNameTr">
                    <td align="right">修改前字段名：</td>
                    <td align="left">
                        <input name="originalColumName" id="originalColumName" class="easyui-combobox"
                               style="width: 350px"
                               data-options="valueField:'columnName',textField:'columnChineseName',prompt:'==请选择=='"
                               missingMessage="请选择正确修改前字段名"
                               validType="comboxValidate['originalColumName','请选择正确修改前字段名']"
                        />
                    </td>
                </tr>
                <tr>
                    <td align="right">内容是否为中文：</td>
                    <td>
                        <input id="matcherChineseContent" name="matcherChineseContent" editable="false"
                               class="easyui-combobox" data-options="prompt:'==请选择==',panelHeight:'auto', valueField: 'label', textField: 'value',
                                    data: [{ label: '1',  value: '是' },{ label: '2', value: '否'}]"/>
                    </td>
                </tr>
                <tr>
                    <td align="right">所属模块：</td>
                    <td>
                        <input id="columnModular" name="columnModular" style="width: 350px" multiple="multiple"
                               cascadeCheck="true"
                               data-options="required:false,prompt:'==请选择==',panelHeight:'auto'"
                               class="easyui-combotree"
                               missingMessage="请选择所属模块" validType="comtreeValidate['columnModular','请选择所属模块']"/>
                    </td>
                </tr>
                <tr>
                    <td align="right">所属客户：</td>
                    <td>
                        <input id="columnCustomer" name="columnCustomer" style="width: 350px" multiple="multiple"
                               cascadeCheck="true"
                               data-options="required:false,prompt:'==请选择=='"
                               class="easyui-combotree"
                               missingMessage="请选择所属客户" validType="comtreeValidate['columnCustomer','请选择所属客户']"/>
                    </td>
                </tr>
                <tr>
                    <td align="right">所属报表：</td>
                    <td>
                        <input id="columnReport" name="columnReport" style="width: 350px" multiple="multiple"
                               cascadeCheck="true"
                               data-options="required:false,prompt:'==请选择==',panelHeight:'auto'"
                               class="easyui-combotree"
                               missingMessage="请选择所属报表" validType="comtreeValidate['columnReport','请选择所属报表']"/>
                    </td>
                </tr>
                <tr>
                    <td align="right">默认值：</td>
                    <td colspan="3">
                        <input class="easyui-textbox" name="columnDefault" id="columnDefault" validType="isjson"
                               data-options="multiline:true" style="height:80px;width:350px"/>
                    </td>
                </tr>
                <tr>
                    <td align="right">字段描述：</td>
                    <td colspan="3">
                        <input class="easyui-textbox" name="columnDescribe"
                               data-options="multiline:true" style="height:80px;width:350px"/>
                    </td>
                </tr>
                <tr id="deleteReasonTr">
                    <td align="right">修改说明：</td>
                    <td colspan="3">
                        <input class="easyui-textbox" name="deleteReason"
                               data-options="multiline:true" style="height:80px;width:350px"/>
                    </td>
                </tr>
            </table>
        </div>
    </form>
</div>

<!--查看字典页面-->
<div id="dlgDataDicCode" class="easyui-dialog" style="width:900px;height:400px"
     closed="true" modal="true" maximizable="true" resizable="true">
    <div id="dgDataDicCode"></div>
</div>


<!--集市层表依赖查询-->
<div id="dlgTableInfo" class="easyui-dialog" style="width:750px;height:500px"
     closed="true" modal="true" maximizable="true" resizable="true" buttons="#dlg-buttonsTableInfo">
    <form method="post" id="tabfrom1">
        <br>
        <table class="form-table">
            <tr>
                <td>表名：</td>
                <td align="left">
                    <input id="tableName" style="width:150px"/>
                </td>
                <td>中文名称：</td>
                <td align="left">
                    <input id="chineseName" style="width:150px"/>
                    <a class="easyui-linkbutton" iconCls='icon-search' onclick="doSearchTableInfo();">查询</a>
                </td>
            </tr>
        </table>
        <br>
    </form>
    <input type="hidden" id="tableIdrely">
    <input type="hidden" id="columnIdrely">
    <div id="dgTableInfo"></div>

    <div id="dlg-buttonsTableInfo" style="text-align:center">
        <shiro:hasPermission name="reportworld:tableDetail:table:add">
            <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add"
               onclick="addTableTableInfo()">添加</a>
        </shiro:hasPermission>
        <shiro:hasPermission name="reportworld:tableDetail:table:edit">
            <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit"
               onclick="editTableTableInfo()">修改</a>
        </shiro:hasPermission>
        <shiro:hasPermission name="reportworld:tableDetail:table:del">
            <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel"
               onclick="delTableTableInfo()">删除</a>
        </shiro:hasPermission>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-back"
           onclick="$('#dlgTableInfo').dialog('close')">返回</a>
    </div>
</div>


<!--依赖表信息添加-->
<div id="dlgTableInfoView" class="easyui-dialog" style="width:500px;height:310px"
     closed="true" modal="true" maximizable="true" resizable="true">
    <form method="post" id="myformTableInfoView">
        <div style="padding:20px">
            <table cellpadding="2px" cellspacing="0" class="form-table">
                <input type="hidden" id="tabletalbeId" name="id">
                <input type="hidden" id="tableIdrely2" name="tableId">
                <input type="hidden" id="columnIdrely2" name="columnId">
                <input type="hidden" id="ftyperely2" name="ftype">
                <tr>
                    <td align="right">依赖的表：</td>
                    <td>
                        <input name="tableIdRely" id="relyTables" class="easyui-combobox" style="width: 350px"
                               data-options=" required: true,valueField:'id',textField:'chineseName',prompt:'==请选择=='"
                               missingMessage="请选择正确依赖的表"
                               validType="comboxValidate['relyTables','请选择正确依赖的表']"
                        />
                    </td>
                </tr>
                <tr id="relyTableColumnTr" style="display: none">
                    <td align="right">表字段：</td>
                    <td>
                        <input name="columnIdRely" id="relyTableCloum" class="easyui-combobox" style="width: 350px"
                               data-options="valueField:'id',textField:'columnChineseName',prompt:'==请选择=='"
                               missingMessage="请选择正确依赖的表字段"
                               validType="comboxValidate['relyTableCloum','请选择正确依赖的表字段']"
                        />
                    </td>
                </tr>
                <td align="right">版本号：</td>
                <td>
                    <input id="tabletableVersion" name="version"
                           data-options="valueField:'value',textField:'showmsg' ,panelHeight:'auto',prompt:'==请选择=='"
                           class="easyui-combobox"/>
                </td>
                <tr>
                    <td align="right">状态：</td>
                    <td>
                        <input name="status" id="relyTableStatus"
                               data-options="valueField:'value',textField:'showmsg' ,panelHeight:'auto',prompt:'==请选择=='"
                               class="easyui-combobox"/>
                    </td>
                </tr>
            </table>
        </div>
    </form>
</div>


<!--修改信息查询-->
<div id="dlgDataDemandBug" class="easyui-dialog" style="width:750px;height:500px"
     closed="true" modal="true" maximizable="true" resizable="true" buttons="#dlg-buttonsUpdateDataSqlInfo">
    <form method="post" id="tabfromDataDemandBug">
    </form>
    <div id="dgDataDemandBug"></div>
    <input type="hidden" id="dataId"> <!--数据ID-->
    <input type="hidden" name="dataCodeView" id="dataCodeView"> <!--数据编码-->
    <div id="dlg-buttonsUpdateDataSqlInfo" style="text-align:center">
        <shiro:hasPermission name="reportworld:tableDetail:update:add">
            <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add"
               onclick="addDataDemandBug()">添加</a>
        </shiro:hasPermission>
        <shiro:hasPermission name="reportworld:tableDetail:update:edit">
            <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit"
               onclick="editDataDemandBug()">修改</a>
        </shiro:hasPermission>
        <shiro:hasPermission name="reportworld:tableDetail:update:del">
            <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel"
               onclick="delDataDemandBug()">删除</a>
        </shiro:hasPermission>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-back"
           onclick="$('#dlgDataDemandBug').dialog('close')">返回</a>
    </div>
</div>

<!--修改信息查询添加-->
<div id="dlgDataDemandBugView" class="easyui-dialog" style="width:600px;height:510px"
     closed="true" modal="true" maximizable="true" resizable="true">
    <form method="post" id="myformDataDemandBug">
        <div style="padding:20px">
            <table cellpadding="2px" cellspacing="0" class="form-DataSql">
                <input type="hidden" name="id" id="dataDemandBugId"> <!--关联关系表的ID-->
                <input type="hidden" name="dataId" id="dataDemandBugDataId">  <!--数据ID-->
                <input type="hidden" name="dataCode" id="dataCode"> <!--数据编码-->
                <tr>
                    <td align="right">需求/BUG编号：</td>
                    <td colspan="3">
                        <input id="demandBugInfo" ediDataSql="false" name="demandBugId" class="easyui-combobox"
                               data-options="valueField:'id',textField:'demandBugNum' ,prompt:'==请选择=='"
                               validType="checkDataDemandBug['dataDemandBugFirst','已经存在该需求BUG关系，请更换！']"/>
                        <input type="hidden" class="textbox" name="dataDemandBugFirst" id="dataDemandBugFirst"/>
                        <!--之前的-->
                    </td>
                </tr>
                <tr>
                    <td align="right">需求/BUG：</td>
                    <td colspan="3">
                        <input id="demandBugType" name="demandBugType" ediDataSql="false" disabled
                               class="easyui-combobox" data-options="prompt:'==请选择==',panelHeight:'auto', valueField: 'label', textField: 'value',
                                    data: [{ label: '1',  value: '需求' },{ label: '2', value: 'BUG'}]"
                               validType="comboxValidate['demandBugType','请选择需求还是BUG']"/>
                    </td>
                </tr>
                <tr>
                    <td align="right">说明：</td>
                    <td colspan="3">
                        <input class="easyui-textbox" name="description" id="description" disabled
                               missingMessage="请输入字段顺序！"
                               data-options="multiline:true,required:false" style="height:270px;width:350px"/>
                    </td>
                </tr>
            </table>
        </div>
    </form>
</div>

<div th:include="common_js :: commJS"></div>
<script type="text/javascript"
        th:src="@{/js/reportworld/tableDetail.js}"></script>
<script type="text/javascript"
        th:src="@{/js/reportworld/common.js}"></script>
</body>
</html>
